﻿using dreamwork.auth.api.Infrastructure;
using DreamWork.Configuration;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;

namespace dreamwork.auth.api
{
	public class Program
	{
		public static void Main(string[] args)
		{
			/*
			var builder = CreateWebHostBuilder(args.Where(arg => arg != "--console").ToArray());
			var isService = !(Debugger.IsAttached || args.Contains("--console"));

			if (isService)
			{
				builder.ApplyServiceContentRoot();
			}

			var host = builder.Build();

			if (isService)
			{
				host.RunAsCustomService();
			}
			else
			{
				host.Run();
			}
			*/
			var host=CreateWebHostBuilder(args).Build();
			host.MigrateDbContext<SqlServerDBContext>((context, services) =>
			{
			});
			host.Run();

		}

		public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
			WebHost.CreateDefaultBuilder(args)
				.UseStartup<Startup>();
	}
}
